<?php
    require_once "sql.php";
    $key=$_POST['key'];
    $str="select * from file where isPublic = '1' ";
    $data=array();
    $error=1;
    $i=0;
    if($key=='zhonger'){
        $result=$conn->query($str);
        if ($result->num_rows > 0) {
            while($row = $result->fetch_assoc()) {
                    $error=0;
                    $data[$i]['filename']=$row['file_name'];
                    $data[$i]['author']=$row['author'];
                    $data[$i]['create_time']=$row['create_time'];
                    $data[$i]['update_time']=$row['update_time'];
                    $i++;      
            }
            $error=0;
            echo json_encode($data);
        } 
    } 
    $conn->close();
?>